<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:forEach var="category" items="${categories}">
	<c:choose>
		<c:when test="${fn:length(category.reports) > 0}">
			<a class="menuitem submenuheader" href=""><c:out value="${ category.categoryName }" /> </a>
			<div class="submenu">
				<ul>
					<c:forEach var="report" items="${category.reports}">
						<li>
							<a id="<c:out value="${ report.reportId }" />"><c:out value="${ report.reportName }" /> </a>
						</li>
					</c:forEach>
				</ul>
			</div>
			<c:set var="categories" value="${category.reportCategories}" scope="request" />
			<jsp:include page="/WEB-INF/jsp/menu.jsp" />
		</c:when>
		<c:otherwise>
			<c:choose>
				<c:when test="${fn:length(category.reportCategories) > 0}">
					<a class="menuitem submenuheader" href=""><c:out value="${ category.categoryName }" /> </a>
					<div class="submenu">
						<c:if test="${fn:length(category.reports) > 0}">
							<ul>
								<c:forEach var="report" items="${category.reports}">
									<li>
										<a href=""><c:out value="${ report.reportName }" /> </a>
									</li>
								</c:forEach>
							</ul>
						</c:if>
					</div>
				</c:when>
			</c:choose>
			<a class="menuitem" href=""><c:out value="${ category.categoryName }" /> </a>
		</c:otherwise>
	</c:choose>
</c:forEach>

